package image.filter;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class HighPassFilter extends Filter{
	private float ponderador;
	public HighPassFilter(int dimension) {
		this.dimension = dimension;
		this.ponderador = 1/(dimension*dimension);
	}


	/**
	 * trabaja con el filtro pasalato
	 */
	protected int calculateValue(int[][] mask) {
		int ans = 0;
		for (int i = 0; i < mask.length; i++) {
			for (int j = 0; j < mask[i].length; j++) {
				if(i == j){
					ans -= mask[i][j];
				}else{
					ans += ((mask.length *mask[i].length ) -1) * mask[i][j];
				}
			}
		}
		// System.out.println("ans" + ans);
		// System.out.println("mean" +
		// (int)Math.floor((double)1/(ans*ponderador)));
		return (int) Math.floor(ans * mask.length * mask.length);
	}
}
